$(function() {
	//计算rem的
  function calcRem() {
    var http = document.getElementsByTagName("html")[0];
    var w = document.documentElement.clientWidth;
    http.style.fontSize = w / 16 + "px";
  }
  calcRem();
  window.onresize = function() {
    calcRem();
  };
  $(".category-nav .swiper-slide").each(function() {
    var wordLength = $(this).find("a").html().length;
    var size = (wordLength * 28 + 50) / 40 + "rem";
    $(this).css("width", size)

    // console.log($(this).find("a").html().length)
  })

  /*导航*/
  $(".category-btn").click(function() {
    $(".category").toggle()
  })

  // 分类导航
  var swiper2 = new Swiper('.swiper-container2', {
    slidesPerView: 'auto',
    centeredSlides: false,
    paginationClickable: true,
    spaceBetween: 0,
    scrollbar: '.swiper-scrollbar',
  });
  // 轮播图
  var swiper = new Swiper('.swiper-container', {
    pagination: '.swiper-pagination',
    paginationClickable: true
  });


});

